#ifndef CMDLINEOPTIONEXCEPTIONS_H_JM_20121220
#define CMDLINEOPTIONEXCEPTIONS_H_JM_20121220

#include <exception>
#include <string>

namespace jmlib {
	
	class CmdLineOptionException : public std::exception {
	public:
		CmdLineOptionException(const std::string& optName, 
			const std::string& what) 
			: what_(what) 
			, optName_(optName) { }

		virtual const char* what() const override { return what_.c_str(); }
		const char* getOptionName() const { return optName_.c_str(); }
	private:
		const std::string what_;
		const std::string optName_;
	};


	class CmdLineOptionNotFoundException : public CmdLineOptionException {
	public:
		CmdLineOptionNotFoundException(const std::string& notFoundOptName)
			: CmdLineOptionException(notFoundOptName, notFoundOptName + " is not defined option name.") { }
	};

	class CmdLineOptionMissingValueException : public CmdLineOptionException {
	public:
		CmdLineOptionMissingValueException(const std::string& optName)
			: CmdLineOptionException(optName, optName + " option required complementary value.") { }
	};


	class CmdLineIsolatedArgumentException : public CmdLineOptionException {
	public:
		CmdLineIsolatedArgumentException(const std::string& arg)
			: CmdLineOptionException("", arg + " -> Isolated command line argument is not allowed! ") { }
	};


	//class CmdLineOptionToMuchValuesException : public CmdLineOptionException {
	//public:
	//	CmdLineOptionToMuchValuesException(const std::string& optName)
	//		: CmdLineOptionException(optName, optName + " option don't accept more values.") { }
	//};

	//class CmdLineOptionBadValueFormatException : public CmdLineOptionException {
	//public:
	//	CmdLineOptionBadValueFormatException(const std::string& optName, const std::string& value)
	//		: CmdLineOptionException(optName, optName + " option value has bad format.")
	//		, value_(value) { }

	//	const char* getBadValue() const { return value_.c_str(); }
	//private:
	//	const std::string value_;
	//};

} // namespace jmlib

#endif
